<html>
<head><meta charset="utf-8"><title>-Zdump-metadata · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html">-Zdump-metadata</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="227785546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227785546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227785546">(Feb 25 2021 at 15:32)</a>:</h4>
<p>I was working on -Zdump-metadata to allow us to dump metadata information for debugging purposes</p>



<a name="227785609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227785609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227785609">(Feb 25 2021 at 15:32)</a>:</h4>
<p>I have a couple of things that I'm not really set on and wanted to know your thoughts</p>



<a name="227785664"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227785664" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227785664">(Feb 25 2021 at 15:33)</a>:</h4>
<p>like should we offer <code>-Zdump-metadata=crate_name</code>?</p>



<a name="227785752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227785752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227785752">(Feb 25 2021 at 15:33)</a>:</h4>
<p>also maybe <code>-Zdump-metadata=all</code> or even <code>-Zdump-metadata=local</code>?</p>



<a name="227785902"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227785902" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227785902">(Feb 25 2021 at 15:34)</a>:</h4>
<p>How would =local be different from unpretty=hir?</p>



<a name="227785952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227785952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227785952">(Feb 25 2021 at 15:34)</a>:</h4>
<p>also, what information do we want to dump? everything that is on <code>CrateMetadata</code> maybe?</p>



<a name="227786093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227786093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227786093">(Feb 25 2021 at 15:35)</a>:</h4>
<p>Hmm... I was initially thinking that the flag could just be <code>-Zdump-metadata</code> and if you don't want a dependency to get dumped, don't pass it to this rustc invocation (as all inputs must come from an argument, right?)</p>



<a name="227786124"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227786124" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Olivier FAURE <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227786124">(Feb 25 2021 at 15:35)</a>:</h4>
<p>I don't know if it answers your question, but my general workflow when working on that stuff is "I know that I have data that looks like X, now where in the code can X be produced?" Usually I'm starting from the end (a console output, an error message, etc), and trying to get back "up" the causal chain.</p>



<a name="227786207"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227786207" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227786207">(Feb 25 2021 at 15:36)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227785902">said</a>:</p>
<blockquote>
<p>How would =local be different from unpretty=hir?</p>
</blockquote>
<p>local will show the stuff that we are encoding and storing as metadata, whereas unpretty=hir shows more information than that</p>



<a name="227786215"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227786215" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227786215">(Feb 25 2021 at 15:36)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> that doesn't let you dump some dependencies but not others though</p>



<a name="227786297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227786297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227786297">(Feb 25 2021 at 15:36)</a>:</h4>
<p>Since usually you need all dependencies even to build the crate</p>



<a name="227786335"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227786335" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227786335">(Feb 25 2021 at 15:37)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227786215">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="124288">oli</span> that doesn't let you dump some dependencies but not others though</p>
</blockquote>
<p>I think the big question is whether dumping needs to build the crate at all</p>



<a name="227786410"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227786410" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227786410">(Feb 25 2021 at 15:37)</a>:</h4>
<p>like we don't actually need an input file, we "just need a tcx"</p>



<a name="227786439"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227786439" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227786439">(Feb 25 2021 at 15:37)</a>:</h4>
<p>and then iterate over all dependencies as specified on the command line, and dump their metadata</p>



<a name="227786442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227786442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227786442">(Feb 25 2021 at 15:37)</a>:</h4>
<p>oh I see, I was imagining it as a side effect but it might make more sense to have it <em>only</em> emit metadata</p>



<a name="227786453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227786453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227786453">(Feb 25 2021 at 15:37)</a>:</h4>
<p>We already have the <code>-Zls</code> option, though it currently only lists external dependencies of the passed in rlib.</p>



<a name="227786551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227786551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227786551">(Feb 25 2021 at 15:38)</a>:</h4>
<div class="codehilite"><pre><span></span><code>$ rustc -Zls $(rustc --print sysroot)/lib/rustlib/*/lib/libstd-*.so
=External Dependencies=
1 core-9ea09a899c3eda46
2 compiler_builtins-ea377e9224b11a8a
3 rustc_std_workspace_core-90996f4879673567
4 alloc-aa547327a7679d28
5 libc-3ccc4a4f3013e9ef
6 unwind-32b57ee4d7c8dc07
7 cfg_if-d9f2cb19c79e847e
8 hashbrown-f2c707309e5edc5c
9 rustc_std_workspace_alloc-6b6b4b2bc151fc5a
10 rustc_demangle-22cd238a7814521c
11 addr2line-f12d17a047776008
12 gimli-3d968aa3120f6a27
13 object-323dea4ee1c9a010
14 miniz_oxide-fe971cf9622d0c47
15 adler-9ff49e5df977573d
16 panic_unwind-b69e89b2ef7e009e
</code></pre></div>



<a name="227786640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227786640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227786640">(Feb 25 2021 at 15:38)</a>:</h4>
<p>hmm... that would also be possible, not even dump multiple dependencies, but allow rustc to be invoked on a .rmeta file and dump it</p>



<a name="227786768"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227786768" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227786768">(Feb 25 2021 at 15:39)</a>:</h4>
<p>That does sound really nice</p>



<a name="227786906"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227786906" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227786906">(Feb 25 2021 at 15:40)</a>:</h4>
<p>combined with <code>-Zls</code> you can then manually walk the dependency graph\</p>



<a name="227787176"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227787176" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227787176">(Feb 25 2021 at 15:42)</a>:</h4>
<p>Have you all seen <a href="https://github.com/bjorn3/rust_read_rlib">https://github.com/bjorn3/rust_read_rlib</a> yet? Doesn't work with the latest nightly (or any less than like a year old) though unfortunately.</p>



<a name="227787298"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227787298" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227787298">(Feb 25 2021 at 15:43)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227786906">said</a>:</p>
<blockquote>
<p>combined with <code>-Zls</code> you can then manually walk the dependency graph\</p>
</blockquote>
<p>not sure if I understand the full workflow you're proposing</p>



<a name="227787474"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227787474" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227787474">(Feb 25 2021 at 15:44)</a>:</h4>
<p>I have not seen <span class="user-mention" data-user-id="133247">@bjorn3</span>'s tool yet at all, but that sounds pretty much like what I envisioned</p>



<a name="227787694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227787694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227787694">(Feb 25 2021 at 15:46)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116266">Santiago Pastorino</span> <a href="#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227787298">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227786906">said</a>:</p>
<blockquote>
<p>combined with <code>-Zls</code> you can then manually walk the dependency graph\</p>
</blockquote>
<p>not sure if I understand the full workflow you're proposing</p>
</blockquote>
<p>I was thinking that you'd call essentially <code>rustc -Zdump-metadata some_meta_file.rlib</code> which gives you a dump similar to the <code>rust_read_lib</code>. Either the dependency information is dumped righ there, or <code>-Zls</code> dumps the depdencencies and you can go find them this way and dump them</p>



<a name="227787695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227787695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227787695">(Feb 25 2021 at 15:46)</a>:</h4>
<p>I was thinking about doing stuff like <code>./x.py test src/ui/something -Zdump-metadata=some_crate</code></p>



<a name="227787728"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227787728" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227787728">(Feb 25 2021 at 15:46)</a>:</h4>
<p>and have that dumping the info</p>



<a name="227787785"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227787785" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227787785">(Feb 25 2021 at 15:46)</a>:</h4>
<p>I guess you're suggesting to save an rmeta file and run something like <span class="user-mention" data-user-id="133247">@bjorn3</span>'s tool outside the flow?</p>



<a name="227787828"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227787828" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227787828">(Feb 25 2021 at 15:46)</a>:</h4>
<p>well, that needs some additional x.py logic, but it would then just forward to whatever does the dump for one rlib file</p>



<a name="227787948"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227787948" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227787948">(Feb 25 2021 at 15:47)</a>:</h4>
<p>compiletest already knows about the rlib filename that gets generated so it can call additional logic on that file</p>



<a name="227788097"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227788097" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227788097">(Feb 25 2021 at 15:48)</a>:</h4>
<p>maybe the thing is that in my approach I wasn't even thinking about rlib/rmeta files because I was trying to hook even before storing the file</p>



<a name="227788163"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227788163" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227788163">(Feb 25 2021 at 15:48)</a>:</h4>
<p>yea, but that requires you to first build the entire current crate</p>



<a name="227788201"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227788201" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227788201">(Feb 25 2021 at 15:48)</a>:</h4>
<p>like I wanted to step when we have all the information to be dumped in <code>CrateMetadata</code> and use that struct to print it out</p>



<a name="227788227"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227788227" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227788227">(Feb 25 2021 at 15:49)</a>:</h4>
<p>when metadata dumping can be "reading an existing metadata file and dumping it"</p>



<a name="227788316"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227788316" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227788316">(Feb 25 2021 at 15:49)</a>:</h4>
<p>when you load a dependency, you also get that struct, and then you can start printing that out</p>



<a name="227788326"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227788326" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227788326">(Feb 25 2021 at 15:49)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227788227">said</a>:</p>
<blockquote>
<p>when metadata dumping can be "reading an existing metadata file and dumping it"</p>
</blockquote>
<p>yeah I understand what you meant ... thinking what's more useful</p>



<a name="227788371"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227788371" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227788371">(Feb 25 2021 at 15:49)</a>:</h4>
<p>I was mainly thinking about dumping things I'm developing and not things that live on <a href="http://crates.io">crates.io</a></p>



<a name="227788465"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227788465" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227788465">(Feb 25 2021 at 15:50)</a>:</h4>
<p>unix philosophy says my idea <span aria-label="stuck out tongue" class="emoji emoji-1f61b" role="img" title="stuck out tongue">:stuck_out_tongue:</span> but that's not necesarily the best way</p>



<a name="227788498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227788498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227788498">(Feb 25 2021 at 15:50)</a>:</h4>
<p>:P</p>



<a name="227788544"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227788544" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227788544">(Feb 25 2021 at 15:50)</a>:</h4>
<p>well, I would hope that we'd have some cargo subcommand that just builds the crate and then uses the metadata dumper on the built crate</p>



<a name="227788585"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227788585" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227788585">(Feb 25 2021 at 15:50)</a>:</h4>
<p>this way you would get the best of both worlds</p>



<a name="227788731"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227788731" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227788731">(Feb 25 2021 at 15:51)</a>:</h4>
<p>A metadata dumper for rlibs could also be used to inspect for example the already built sysroot or it can inspect rlibs shipped by someone who didn't want to release the source code of their crate.</p>



<a name="227788770"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227788770" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227788770">(Feb 25 2021 at 15:51)</a>:</h4>
<p>so ... if I have a test that lives on <code>test/ui</code> and there lives one main and another crate, how the workflow to dump the metadata of that crate would be in your solution?</p>



<a name="227788885"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227788885" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227788885">(Feb 25 2021 at 15:52)</a>:</h4>
<p><span class="user-mention silent" data-user-id="133247">bjorn3</span> <a href="#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227788731">said</a>:</p>
<blockquote>
<p>A metadata dumper for rlibs could also be used to inspect for example the already built sysroot or it can inspect rlibs shipped by someone who didn't want to release the source code of their crate.</p>
</blockquote>
<p>yeah, this is for sure something cool in my opinion</p>



<a name="227789040"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227789040" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227789040">(Feb 25 2021 at 15:53)</a>:</h4>
<p>I just want to also make it easier for rustc usage, ideally one run dumps what I want or something like that</p>



<a name="227789060"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227789060" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227789060">(Feb 25 2021 at 15:53)</a>:</h4>
<p>I think using a metadata dumper for tests would require a way to embed the crate metadata in executables. This can also be useful for other things.</p>



<a name="227789199"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227789199" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227789199">(Feb 25 2021 at 15:54)</a>:</h4>
<p>why would require that?</p>



<a name="227789254"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227789254" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227789254">(Feb 25 2021 at 15:54)</a>:</h4>
<p>talking about let's say <a href="http://testa.rs">testa.rs</a> that depends on <a href="http://dependencyb.rs">dependencyb.rs</a> (dependencyb is a crate) and <a href="http://testa.rs">testa.rs</a> uses that crate</p>



<a name="227789267"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227789267" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227789267">(Feb 25 2021 at 15:54)</a>:</h4>
<p>I want to dump <a href="http://dependencyb.rs">dependencyb.rs</a> metadata</p>



<a name="227789364"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227789364" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227789364">(Feb 25 2021 at 15:55)</a>:</h4>
<p>For dependencyb it would work already, but for testa there is no crate metadata currently encoded.</p>



<a name="227789398"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227789398" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227789398">(Feb 25 2021 at 15:55)</a>:</h4>
<p>yeah</p>



<a name="227833653"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227833653" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227833653">(Feb 25 2021 at 20:31)</a>:</h4>
<p>when I have some time I'll make this work as <span class="user-mention" data-user-id="124288">@oli</span> has described</p>



<a name="227833668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227833668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227833668">(Feb 25 2021 at 20:31)</a>:</h4>
<p>so, just in case we are all in the same ...</p>



<a name="227833694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227833694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227833694">(Feb 25 2021 at 20:31)</a>:</h4>
<p>gonna make <code>rustc -Zdump-metadata file.rmeta</code> work</p>



<a name="227833723"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227833723" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227833723">(Feb 25 2021 at 20:31)</a>:</h4>
<p>you would need to generate the file and then run that</p>



<a name="227833807"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227833807" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227833807">(Feb 25 2021 at 20:32)</a>:</h4>
<p>as a second step we could make some fancier things like making compiletest do everything or stuff like that</p>



<a name="227833862"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227833862" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227833862">(Feb 25 2021 at 20:32)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> I guess I could try to re-use some code from your project or even try to revive it?</p>



<a name="227833876"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227833876" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227833876">(Feb 25 2021 at 20:32)</a>:</h4>
<p>unsure what was your plan with it</p>



<a name="227834942"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227834942" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227834942">(Feb 25 2021 at 20:39)</a>:</h4>
<p><span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> Feel free to re-use/revive it. I don't plan to revive it myself any time soon.</p>



<a name="227835131"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227835131" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227835131">(Feb 25 2021 at 20:41)</a>:</h4>
<p>If I recall correctly some things of rustc_metadata that were used by rust_read_rlib were made private though.</p>



<a name="227862442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227862442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Zdump-metadata.html#227862442">(Feb 26 2021 at 00:20)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/131828-t-compiler/topic/-Zdump-metadata/near/227786093">said</a>:</p>
<blockquote>
<p>Hmm... I was initially thinking that the flag could just be <code>-Zdump-metadata</code> and if you don't want a dependency to get dumped, don't pass it to this rustc invocation (as all inputs must come from an argument, right?)</p>
</blockquote>
<p>Some inputs come from the sysroot (like <code>std</code>) though, right?</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>